package com.sheng.web.controller.web.contoller;

import com.sheng.config.SpringConfig;

import com.sheng.domain.User;
import com.sheng.service.UserService;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import java.util.List;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = SpringConfig.class)
public class Test01 {
    @Autowired
    private UserService userService;
    @Test
    public void test01(){
        List<User> all = userService.findAll();
        for (User user : all) {
            System.out.println(user);
        }
    }
    @Test
    public void test02(){
        User user=new User();
        user.setUsername("夏小雪");
        user.setPassword("2222");
          userService.save(user);
        }

}
